home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume10 / cbw / part02 < prev    next >
Encoding:
Text File  |  1987-06-16  |  53.7 KB  |  2,766 lines

  1. Path: seismo!uunet!rs
  2. From: rs@uunet.UU.NET (Rich Salz)
  3. Newsgroups: comp.sources.unix
  4. Subject: v10i002:  Crypt Breaker's Workbench, Part02/11
  5. Message-ID: <374@uunet.UU.NET>
  6. Date: 17 Jun 87 22:37:32 GMT
  7. Organization: UUNET Communications Services, Arlington, VA
  8. Lines: 2755
  9. Approved: rs@uunet.uu.net
  10.  
  11. Submitted by: Robert W. Baldwin <BALDWIN@XX.LCS.MIT.EDU>
  12. Mod.sources: Volume 10, Issue 2
  13. archive-name: cbw/Part02
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then unpack
  17. # it by saving it into a file and typing "sh file".  To overwrite existing
  18. # files, type "sh file -c".  You can also feed this as standard input via
  19. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  20. # will see the following message at the end:
  21. #        "End of archive 2 (of 11)."
  22. # Contents:  bdriver.c cipher.h edriver.c gblock.c mss-bigram-old.stats
  23. #   perm.c start.c terminal.h test2.txt webster.c windowlib.c
  24. # Wrapped by rs@uunet on Wed Jun 17 18:17:05 1987
  25. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  26. if test -f bdriver.c -a "${1}" != "-c" ; then 
  27.   echo shar: Will not over-write existing file \"bdriver.c\"
  28. else
  29. echo shar: Extracting \"bdriver.c\" \(3896 characters\)
  30. sed "s/^X//" >bdriver.c <<'END_OF_bdriver.c'
  31. X/*
  32. X * Test driver for BIGRAM character guessing stuff.
  33. X */
  34. X
  35. X#include    <stdio.h>
  36. X#include    <math.h>
  37. X#include    "window.h"
  38. X#include    "specs.h"
  39. X#include    "cipher.h"
  40. X
  41. X
  42. X#define NDOBLOCKS    2        /* Number of blocks to do. */
  43. X#define    DEBUG        FALSE
  44. X
  45. Xecinfo    myecinfo;
  46. X
  47. Xchar    plainbuf[BLOCKSIZE+1];
  48. Xfloat    accept_level;
  49. Xfloat    prob_cutoff;
  50. X
  51. Xextern    ec_best(), ec_dplain(), ec_dscipher();
  52. Xextern    ec_dnext(), ec_dsizetab(), ec_dperm(), ec_dpmap();
  53. Xextern    ec_init(), ec_best(), ec_cscore();
  54. Xextern    lp_init(), lp_best_char(), lp_cscore(), lp_accept(), lp_best_pos();
  55. Xextern    lp_dclasses();
  56. X
  57. Xextern    char    mcbuf[];
  58. Xextern    char    *fname;            /* Used by fillcbuf. */
  59. X/* Test routine for equiv class info. */
  60. Xmain(argc, argv)
  61. Xint        argc;
  62. Xchar    *argv[];
  63. X{
  64. X    ecinfo    *eci;
  65. X    FILE    *inp;
  66. X    FILE    *sout, *sin;
  67. X    int        i, blknum;
  68. X    int        maxblock;
  69. X    long    filelength;
  70. X    char    infile[100];
  71. X    char    inplain[100];
  72. X    char    *plain = ".txt";
  73. X    char    *code = ".cipher";
  74. X    char    *p, *q;
  75. X
  76. X    sout = stdout;        /* For use within debugger, dbx. */
  77. X    sin = stdin;
  78. X
  79. X    if (argc != 4)  {
  80. X        printf("Usage: %s input_file_root acceptance_level prob_cutoff\n",
  81. X                argv[0]);
  82. X        exit(0);
  83. X        }
  84. X
  85. X    p = inplain;
  86. X    q = argv[1];
  87. X    while (*p++ = *q++);
  88. X    --p;
  89. X    q = plain;
  90. X    while (*p++ = *q++);
  91. X
  92. X    p = infile;
  93. X    q = argv[1];
  94. X    while (*p++ = *q++);
  95. X    --p;
  96. X    q = code;
  97. X    while (*p++ = *q++);
  98. X
  99. X    if (sscanf(argv[2], "%f", &accept_level) != 1)  {
  100. X        printf("Could not parse the acceptance level from %s.\n", argv[2]);
  101. X        exit(0);
  102. X        }
  103. X
  104. X    if (sscanf(argv[3], "%f", &prob_cutoff) != 1)  {
  105. X        printf("Could not parse the probability cutoff from %s.\n", argv[2]);
  106. X        exit(0);
  107. X        }
  108. X
  109. X    printf("\t\tEquivalence Class Guessing\n\n");
  110. X    printf("Filename = %s.  Acceptance level = %4.2f\n",infile,accept_level);
  111. X
  112. X    printf("Loading statistics ...");
  113. X    printf(" 1");
  114. X    load_1stats_from("mss.stats");
  115. X    printf(" 2");
  116. X    load_2stats_from("mss-bigram.stats");
  117. X    printf(" done.\n");
  118. X
  119. X    eci = &myecinfo;
  120. X
  121. X    if ((inp = fopen(infile, "r")) == NULL) {
  122. X        printf("\nCannot open %s for reading.\n", infile);
  123. X        exit(0);
  124. X        }
  125. X    fseek(inp, 0L, 2);
  126. X    filelength = ftell(inp);
  127. X    fclose(inp);
  128. X
  129. X    maxblock = filelength / BLOCKSIZE;
  130. X    if (maxblock > (NDOBLOCKS-1))  maxblock = (NDOBLOCKS-1);
  131. X
  132. X    for (blknum = 0 ; blknum <= maxblock ; blknum++) {
  133. X        do_lp_block(eci, blknum, infile, inplain);
  134. X        }
  135. X}
  136. X
  137. X
  138. X/* Do a block using the letter pair statistics.
  139. X */
  140. Xdo_lp_block(eci, blknum, cfile, plainfile)
  141. Xreg        ecinfo    *eci;
  142. Xint        blknum;
  143. Xchar    *cfile, *plainfile;
  144. X{
  145. X    int        i;
  146. Xreg    int        c;
  147. X    int        ntried;
  148. X    int        naccepted, nwrong;
  149. Xreg    int        classpos;
  150. X    int        charcount;
  151. X    int        *permp, repeat;
  152. X
  153. X    cipherfile = cfile;
  154. X    fillcbuf(blknum, mcbuf);
  155. X    cipherfile = plainfile;
  156. X    fillcbuf(blknum, plainbuf);
  157. X
  158. X    lp_init(mcbuf, refperm(blknum), eci);
  159. X
  160. Xfor(repeat = 0 ; repeat < 3 ; repeat++)  {
  161. X    naccepted = 0;
  162. X    nwrong = 0;
  163. X    ntried = 0;
  164. X
  165. X    for (ntried = 0 ; ntried < BLOCKSIZE ; ntried++)  {
  166. X        classpos = lp_best_pos(eci, 2);
  167. X        if (classpos == NONE)
  168. X            break;
  169. X        c = lp_best_char(eci, classpos,
  170. X                        accept_level - ((repeat == 0) ? 0.0 : 0.0),
  171. X                        prob_cutoff);
  172. X        if (c != NONE) {
  173. X            lp_accept(eci, classpos, c);
  174. X            naccepted++;
  175. X#if DEBUG
  176. X            printf("ACCEPTED");
  177. X#endif
  178. X            if (plainbuf[classpos] != c)  {
  179. X                nwrong++;
  180. X#if DEBUG
  181. X                printf(" -- INCORRECT");
  182. X#endif
  183. X                }
  184. X#if DEBUG
  185. X            printf("\n");
  186. X#endif
  187. X            }
  188. X        }
  189. X
  190. X/*    decode(eci->ciphertext, eci->plaintext, eci->perm);
  191. X*/
  192. X
  193. X    for (i = 0 ; i < eci->nclasses ; i++)  {
  194. X        eci->classlist[i].changed = TRUE;
  195. X        }
  196. X
  197. X
  198. X    charcount = 0;
  199. X     for (i = 0 ; i < BLOCKSIZE ; i++)  {
  200. X        if (eci->plaintext[i] != NONE)  charcount++;
  201. X        }
  202. X
  203. X    printf("\n\nPlaintext for block %d using %d wires", blknum, naccepted);
  204. X    printf(" (%d wrong)", nwrong);
  205. X    printf(" yields %d characters.", charcount);
  206. X    printf("\nThere were %d classes and %d guess tries.",eci->nclasses,ntried);
  207. X    printf("\n\n");
  208. X    ec_dplain(stdout, eci);
  209. X    }
  210. X
  211. X    permp = refperm(blknum);
  212. X    for (i = 0 ; i < BLOCKSIZE ; i++)  {
  213. X        permp[i] = eci->perm[i];
  214. X        }
  215. X}
  216. X
  217. X
  218. Xkey    u_getkey()
  219. X{
  220. X}
  221. X
  222. Xkeyer    topktab[] ={{0, NULL}};
  223. X
  224. X
  225. Xchar    *quitcmd()
  226. X{
  227. X}
  228. END_OF_bdriver.c
  229. if test 3896 -ne `wc -c <bdriver.c`; then
  230.     echo shar: \"bdriver.c\" unpacked with wrong size!
  231. fi
  232. # end of overwriting check
  233. fi
  234. if test -f cipher.h -a "${1}" != "-c" ; then 
  235.   echo shar: Will not over-write existing file \"cipher.h\"
  236. else
  237. echo shar: Extracting \"cipher.h\" \(3531 characters\)
  238. sed "s/^X//" >cipher.h <<'END_OF_cipher.h'
  239. X
  240. X/*
  241. X * Declarations for the information about a block.
  242. X */
  243. X
  244. X
  245. X#define    SZMAX     100    /* Number of classes in ecinfo table. */
  246. X#define    NCLASSES 256    /* Max number of classes of characters in a block. */
  247. X
  248. X
  249. X/* Macros */
  250. X
  251. X/* Iterate of the positions in a class.
  252. X * class is the index of one of the members of an equivalence class.
  253. X * pos is a loop variable assigned to the positions in a class
  254. X * starting with the value of class.
  255. X * Both eci->next and firstflag must be bound in the calling environment.
  256. X * firstflag is just an integer used as a flag, so it does not need to be
  257. X * initialized.  eci->next must be a table of next pointers for this block.
  258. X */
  259. X#define    for_pos_in_class(pos, class)  \
  260. X        for ((pos=class)&(firstflag=TRUE) ; \
  261. X             firstflag || pos != class ; \
  262. X             (firstflag=FALSE)&(pos = eci->next[pos]))
  263. X
  264. X
  265. X/* Return TRUE if given wiring conflicts with the wiring
  266. X * in the given permutation.
  267. X */
  268. X#define    perm_conflict(perm,x,y) \
  269. X        ( ! perm_no_conflict(perm,x,y))
  270. X
  271. X#define perm_no_conflict(perm,x,y) \
  272. X        (   (x != y) \
  273. X         && (   ((perm)[x] == NONE  &&  (perm)[y] == NONE) \
  274. X             || ((perm)[x] == y     &&  (perm)[y] == x)  ))
  275. X
  276. X
  277. X/* Structure Declarations */
  278. X
  279. X
  280. X/* Used for tables of unique permutation wirings. */
  281. X#define    perment    struct xperment
  282. Xperment {
  283. X        int    x;        /* Sorted so x < y. */
  284. X        int    y;        /* x can be NONE. */
  285. X        };
  286. X
  287. X#define    clinfo    struct    clinfox
  288. Xclinfo    {
  289. X        short    nchars;        /* Number of chars in class. */
  290. X        short    npairs;        /* Cur num of chars next to ones in this class. */
  291. X        short    used;        /* True if class has an accepted value. */
  292. X        short    changed;    /* True if best value might have changed. */
  293. X        short    firstpos;    /* Position of first char of this class. */
  294. X        };
  295. X
  296. X#define    adjinfo    struct    adjinfox
  297. Xadjinfo    {
  298. X        short    left;        /* Index of class to the left (or NONE). */
  299. X        short    right;        /* Index of class to the right (or NONE). */
  300. X        };
  301. X
  302. X
  303. X#define    ecsize    struct ecsizex
  304. Xecsize    {
  305. X        int    size;        /* Size of class. */
  306. X        int    firstpos;    /* Index of first member. */
  307. X        };
  308. X
  309. X
  310. X#define    ecinfo    struct    ecinfox
  311. Xecinfo    {
  312. X        /* Index of next free spot in sizelist. */
  313. X        int    sizelast;
  314. X        
  315. X        /* Minimum size of class to put in sizelist. */
  316. X        int    sizemin;
  317. X        
  318. X        /* Table of all the classes sorted largest first. */
  319. X        ecsize    sizelist[SZMAX+1];
  320. X        
  321. X        /* Original ciphertext. */
  322. X        char    ciphertext[BLOCKSIZE+1];
  323. X        
  324. X        /* Cipher chars shifted by  their index. */
  325. X        int    scipher[BLOCKSIZE+1];
  326. X        
  327. X        /* Next[i] is a circular list of the positions of all the */
  328. X        /* members of the class that contains ith cipher char. */
  329. X        int    next[BLOCKSIZE+1];
  330. X        
  331. X        /* Position of first member of the class influenced by perm[i]. */
  332. X        int    permmap[BLOCKSIZE+1];
  333. X        /* Decipher permutation. A  -1 indicated unknown wiring. */
  334. X        
  335. X        /* This is cumulative. */
  336. X        int    perm[BLOCKSIZE+1];
  337. X        
  338. X        /* Cumulative chars deciphered. */
  339. X        int    plaintext[BLOCKSIZE+1];
  340. X        
  341. X        /* Index in classlist to put net class. */
  342. X        int    nclasses;
  343. X        
  344. X        /* List of classes of characters. */
  345. X        clinfo    classlist[NCLASSES];
  346. X        
  347. X        /* Table mapping positions into their class list index. */
  348. X        short    posclass[BLOCKSIZE+1];
  349. X        };
  350. X
  351. X
  352. X/* The gsinfo structure is used to hold information about both
  353. X * guessed at characters and known characters.  Both are needed to
  354. X * compute scores based on letter pairs.
  355. X */
  356. X
  357. X#define    gsinfo    struct    gsinfox
  358. Xgsinfo    {
  359. X        /* Ptr to a plaintext block of accepted chars. */
  360. X        int    *cknown;
  361. X        
  362. X        /* Ptr to a plaintext block of guessed at chars. */
  363. X        int    *cguessed;
  364. X        
  365. X        /* Vector of positions within cguessed that have characters. */
  366. X        /* The list is terminated by -1. */
  367. X        int    cpos[SZMAX+1];
  368. X        };
  369. X
  370. END_OF_cipher.h
  371. if test 3531 -ne `wc -c <cipher.h`; then
  372.     echo shar: \"cipher.h\" unpacked with wrong size!
  373. fi
  374. # end of overwriting check
  375. fi
  376. if test -f edriver.c -a "${1}" != "-c" ; then 
  377.   echo shar: Will not over-write existing file \"edriver.c\"
  378. else
  379. echo shar: Extracting \"edriver.c\" \(3139 characters\)
  380. sed "s/^X//" >edriver.c <<'END_OF_edriver.c'
  381. X/*
  382. X * Test driver for equivalence class stuff.
  383. X */
  384. X
  385. X#include    <stdio.h>
  386. X#include    <math.h>
  387. X#include    "window.h"
  388. X#include    "specs.h"
  389. X#include    "cipher.h"
  390. X
  391. X
  392. Xecinfo    myecinfo;
  393. X
  394. Xchar    plainbuf[BLOCKSIZE+1];
  395. Xfloat    accept_level;
  396. X
  397. Xextern    ec_best(), ec_dplain(), ec_dscipher();
  398. Xextern    ec_dnext(), ec_dsizetab(), ec_dperm(), ec_dpmap();
  399. Xextern    ec_init(), ec_best(), ec_cscore();
  400. X
  401. Xextern    char    mcbuf[];
  402. Xextern    char    *fname;            /* Used by fillcbuf. */
  403. X/* Test routine for equiv class info. */
  404. Xmain(argc, argv)
  405. Xint        argc;
  406. Xchar    *argv[];
  407. X{
  408. X    ecinfo    *eci;
  409. X    FILE    *inp;
  410. X    int        i, blknum;
  411. X    int        maxblock;
  412. X    long    filelength;
  413. X    char    infile[100];
  414. X    char    inplain[100];
  415. X    char    *plain = ".txt";
  416. X    char    *code = ".cipher";
  417. X    char    *p, *q;
  418. X
  419. X    if (argc != 3)  {
  420. X        printf("Usage: %s input_file_root acceptance_level\n", argv[0]);
  421. X        exit(0);
  422. X        }
  423. X
  424. X    p = inplain;
  425. X    q = argv[1];
  426. X    while (*p++ = *q++);
  427. X    --p;
  428. X    q = plain;
  429. X    while (*p++ = *q++);
  430. X
  431. X    p = infile;
  432. X    q = argv[1];
  433. X    while (*p++ = *q++);
  434. X    --p;
  435. X    q = code;
  436. X    while (*p++ = *q++);
  437. X
  438. X    if (sscanf(argv[2], "%f", &accept_level) != 1)  {
  439. X        printf("Could not parse the acceptance level from %s.\n", argv[2]);
  440. X        exit(0);
  441. X        }
  442. X
  443. X    load_1stats_from("mss.stats");
  444. X    eci = &myecinfo;
  445. X
  446. X    if ((inp = fopen(infile, "r")) == NULL) {
  447. X        printf("\nCannot open %s for reading.\n", infile);
  448. X        exit(0);
  449. X        }
  450. X    fseek(inp, 0L, 2);
  451. X    filelength = ftell(inp);
  452. X    fclose(inp);
  453. X
  454. X    maxblock = filelength / BLOCKSIZE;
  455. X    if (maxblock > 19)  maxblock = 19;
  456. X
  457. X    printf("\t\tEquivalence Class Guessing\n\n");
  458. X    printf("Filename = %s.  Acceptance level = %4.2f\n",infile,accept_level);
  459. X    for (blknum = 0 ; blknum <= maxblock ; blknum++) {
  460. X        do_block(eci, blknum, infile, inplain);
  461. X        }
  462. X}
  463. X
  464. X
  465. Xdo_block(eci, blknum, cipherfile, plainfile)
  466. Xecinfo    *eci;
  467. Xint        blknum;
  468. Xchar    *cipherfile, *plainfile;
  469. X{
  470. X    int        i,c,x,y;
  471. X    int        naccepted, nwrong;
  472. X    int        classpos;
  473. X    int        charcount;
  474. X
  475. X    fname = cipherfile;
  476. X    fillcbuf(blknum, mcbuf);
  477. X    fname = plainfile;
  478. X    fillcbuf(blknum, plainbuf);
  479. X
  480. X    ec_init(mcbuf, refperm(blknum), eci);
  481. X
  482. X    naccepted = 0;
  483. X    nwrong = 0;
  484. X
  485. X    for (i = 0 ; i < eci->sizelast ; i++)  {
  486. X        classpos = eci->sizelist[i].firstpos;
  487. X        c = ec_best(eci, classpos, accept_level);
  488. X        if (c != NONE) {
  489. X            x = eci->scipher[classpos];
  490. X            y = MODMASK & (c + classpos);
  491. X            if (eci->perm[x] == NONE  &&  eci->perm[y] == NONE) {
  492. X                naccepted++;
  493. X                eci->perm[x] = y;
  494. X                eci->perm[y] = x;
  495. X/*                printf("ACCEPTING best guess of %d wired to %d.\n",
  496. X                        x, y);
  497. X*/                if ((MODMASK & plainbuf[classpos]) != c) {
  498. X                    nwrong++;
  499. X/*                    printf("*** WRONG ***  First char should be %c.\n",
  500. X                            plainbuf[classpos]);
  501. X*/                    }
  502. X                }
  503. X            else if (eci->perm[x] == y) {
  504. X/*                printf("CONFIRMING guess of %d wired to %d.\n",
  505. X                        x, y);
  506. X*/                }
  507. X            else {
  508. X/*                printf("CONFLICTING guess of %d wired to %d.\n",
  509. X                        x, y);
  510. X*/                }
  511. X            }
  512. X        }
  513. X
  514. X    decode(eci->ciphertext, eci->plaintext, eci->perm);
  515. X
  516. X    charcount = 0;
  517. X    for (i = 0 ; i < BLOCKSIZE ; i++)  {
  518. X        if (eci->plaintext[i] != NONE)  charcount++;
  519. X        }
  520. X
  521. X    printf("\n\nPlaintext for block %d using %d wires", blknum, naccepted);
  522. X    printf(" (%d wrong)", nwrong);
  523. X    printf(" yields %d characters.\n\n", charcount);
  524. X    ec_dplain(stdout, eci);
  525. X}
  526. X
  527. Xkey    u_getkey()
  528. X{
  529. X}
  530. X
  531. Xkeyer    topktab[] ={{0, NULL}};
  532. END_OF_edriver.c
  533. if test 3139 -ne `wc -c <edriver.c`; then
  534.     echo shar: \"edriver.c\" unpacked with wrong size!
  535. fi
  536. # end of overwriting check
  537. fi
  538. if test -f gblock.c -a "${1}" != "-c" ; then 
  539.   echo shar: Will not over-write existing file \"gblock.c\"
  540. else
  541. echo shar: Extracting \"gblock.c\" \(4009 characters\)
  542. sed "s/^X//" >gblock.c <<'END_OF_gblock.c'
  543. X/*
  544. X * Guess block and its label.
  545. X *
  546. X * Robert W. Baldwin, December 1984.
  547. X */
  548. X
  549. X
  550. X#include    <stdio.h>
  551. X#include    "window.h"
  552. X#include    "terminal.h"
  553. X#include    "layout.h"
  554. X#include    "specs.h"
  555. X#include    "cipher.h"        /* RWB */
  556. X#include    "autotri.h"
  557. X
  558. X
  559. X
  560. X/* Private buffers for plaintext guessing. */
  561. X
  562. Xchar    gcbuf[BLOCKSIZE+1];
  563. Xint        gpbuf[BLOCKSIZE+1];
  564. Xint        gperm[BLOCKSIZE+1];
  565. Xecinfo    gecinfo;            /* RWB */
  566. X
  567. Xextern    atrinfo    gatrinfo;
  568. Xextern    char    mcbuf[];
  569. X
  570. X/* Window for the guess block label. */
  571. X
  572. Xdispline    gblline1 = {
  573. X        GBLROW,1,        /* Origin. */
  574. X        1,GBWIDTH,        /* Height and width. */
  575. X        1,1,            /* Initial (relative) cursor pos. */
  576. X        NULL,            /* No private data. */
  577. X        wl_setcur,        /* Firstime = restore cursor pos. */
  578. X        wl_noop,        /* Lasttime = do nothing. */
  579. X        wl_dldraw,        /* Default dispaly line draw routine */
  580. X        dokey,            /* Default keystroke handler. */
  581. X        arwktab,        /* Basic arrow keystroke handler. */
  582. X        1,GBWIDTH,        /* Min and Max col for cursor line */
  583. X};
  584. X
  585. Xdispline    *gbllines[] = {        /* List of display lines for the label. */
  586. X            &gblline1,
  587. X            NULL,
  588. X            };
  589. X
  590. Xtwindow        gblabel = {
  591. X            GBLROW,1,        /* Origin. */
  592. X            1,GBWIDTH,        /* Height and width. */
  593. X            1,1,            /* Initial (relative) cursor position */
  594. X            NULL,            /* No private data. */
  595. X            wl_setcur,        /* Firstime = restore cursor position. */
  596. X            wl_noop,        /* Lasttime = do nothing. */
  597. X            wl_twdraw,        /* Simple draw routine. */
  598. X            dokey,            /* Default keystroke handler. */
  599. X            arwktab,        /* Basic arrow keystroke handler. */
  600. X            gbllines,
  601. X            };
  602. X
  603. X
  604. X/* Window for the guess block. */
  605. X
  606. Xgwindow    gbstore = {
  607. X        GBSROW,1,        /* Origin. */
  608. X        GBHEIGHT,GBWIDTH,    /* Height and width. */
  609. X        1,1,            /* Initial cursor position */
  610. X        NULL,            /* Private data. */
  611. X        wl_setcur,        /* Firstime = accept cursor pos. */
  612. X        wl_noop,        /* Lasttime = do nothing. */
  613. X        wl_outline,        /* Simple draw routine. */
  614. X        dokey,            /* Default keystroke handler. */
  615. X        arwktab,        /* Keystroke table. */
  616. X};
  617. X
  618. X
  619. X
  620. X/* Initialize the guess block label, and return a ptr to it.
  621. X */
  622. Xgwindow    *(igblabel())
  623. X{
  624. X    displine    *line;
  625. X
  626. X    line = gblabel.dlines[0];
  627. X    setadline(line, GBLTEXT);
  628. X    return ((gwindow *) &gblabel);
  629. X}
  630. X
  631. X
  632. X/* Set the label to indicate the given string.
  633. X * Redisplay the label.
  634. X */
  635. Xgblset(label, str)
  636. Xtwindow    *label;
  637. Xchar    *str;
  638. X{
  639. X    int        row,col;
  640. X    displine    *line;
  641. X
  642. X    row = rowcursor();
  643. X    col = colcursor();
  644. X
  645. X    line = label->dlines[0];
  646. X    setadline(line, str);
  647. X    (*(line->wredraw))(line);
  648. X
  649. X    setcursor(row, col);
  650. X}
  651. X
  652. X
  653. X
  654. X/* Initialize the guess block storage, and return a ptr to it.
  655. X * Start with the Trigram guessing window.
  656. X */
  657. Xgwindow    *(igbstore())
  658. X{
  659. X    extern    atrdraw();
  660. X    extern    atr_init();
  661. X    atrinfo    *atri;
  662. X
  663. X    atri = &gatrinfo;
  664. X    atr_init(mcbuf, refperm(dbsgetblk(&dbstore)), atri);
  665. X    gbsswitch(&gbstore, ((char *) atri), arwktab, wl_setcur, wl_noop, atrdraw);
  666. X    return (&gbstore);
  667. X}
  668. X
  669. X
  670. X/* Switch the guessing window to the desired functionality
  671. X * by changing the keytable, private data pointer, firsttime,
  672. X * and lasttime function routines.
  673. X */
  674. Xgbsswitch(gbs, private, keytable, firsttime, lasttime, draw)
  675. Xgwindow    *gbs;
  676. Xchar    *private;
  677. Xkeyer    keytable[];
  678. Xint        (*firsttime)(), (*lasttime)();
  679. Xint        (*draw)();
  680. X{
  681. X    gbs->wprivate = private;
  682. X    gbs->wkeyprocs = keytable;
  683. X    gbs->wfirst = firsttime;
  684. X    gbs->wlast = lasttime;
  685. X    gbs->wredraw = draw;
  686. X}
  687. X
  688. X
  689. X/* Convert block position to relative row/column coordinate.
  690. X */
  691. Xint    gbspos2row(pos)
  692. Xint    pos;
  693. X{
  694. X    return(1 + (pos/LINELEN));
  695. X}
  696. X
  697. X
  698. X/* Convert block position to relative row/column coordinate.
  699. X */
  700. Xint    gbspos2col(pos)
  701. Xint    pos;
  702. X{
  703. X    return(1 + (pos%LINELEN));
  704. X}
  705. X
  706. X
  707. X/* Clear out the guess block marking all character positions as unknown.
  708. X */
  709. Xgbsclear(gbs)
  710. Xgwindow    *gbs;
  711. X{
  712. X    int            i;
  713. X    int            row, col;
  714. X
  715. X    row = 1;
  716. X    col = 1;
  717. X
  718. X    for (i = 0 ; i < BLOCKSIZE ; i++)  {
  719. X        if (i%LINELEN == 0) {
  720. X            wl_setcur(gbs, gbspos2row(i), gbspos2col(i));
  721. X            }
  722. X        plnchars(1, char2sym(NONE));
  723. X        }
  724. X
  725. X    for (i = gbspos2row(BLOCKSIZE) ; i <= GBHEIGHT ; i++) {
  726. X        wl_setcur(gbs, i, 1);
  727. X        plnchars(LINELEN, ' ');
  728. X        }
  729. X
  730. X    for (i = 1 ; i <= GBHEIGHT ; i++) {
  731. X        wl_setcur(gbs, i, LINELEN+1);
  732. X        plnchars(gbs->wwidth - LINELEN, ' ');
  733. X        }
  734. X
  735. X    wl_setcur(gbs, row, col);
  736. X}
  737. END_OF_gblock.c
  738. if test 4009 -ne `wc -c <gblock.c`; then
  739.     echo shar: \"gblock.c\" unpacked with wrong size!
  740. fi
  741. # end of overwriting check
  742. fi
  743. if test -f mss-bigram-old.stats -a "${1}" != "-c" ; then 
  744.   echo shar: Will not over-write existing file \"mss-bigram-old.stats\"
  745. else
  746. echo shar: Extracting \"mss-bigram-old.stats\" \(4489 characters\)
  747. sed "s/^X//" >mss-bigram-old.stats <<'END_OF_mss-bigram-old.stats'
  748. X62719
  749. X
  750. X1 \000\001\002\003\004\005\006\007\177\b\v\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037
  751. X203 ({[<
  752. X1019 Pp
  753. X167 Xx
  754. X328 >)}]
  755. X48 Qq
  756. X746 Yy
  757. X211 @*+|~^=#$%&
  758. X2655 Rr
  759. X45 Zz
  760. X3008 Ss
  761. X879 .,:;?!
  762. X4092 Tt
  763. X647 _-
  764. X1320 Uu
  765. X456 Vv
  766. X22 \\/
  767. X833 Ww
  768. X2143 0123456789
  769. X13592 \t\n\p\r 
  770. X249 '`"
  771. X3498 Aa
  772. X795 Bb
  773. X1498 Cc
  774. X1695 Dd
  775. X5672 Ee
  776. X850 Ff
  777. X1041 Gg
  778. X2144 Hh
  779. X3114 Ii
  780. X83 Jj
  781. X246 Kk
  782. X2034 Ll
  783. X1223 Mm
  784. X2860 Nn
  785. X3302 Oo
  786. X***
  787. X386 TI
  788. X656 \t0
  789. X277 RO
  790. X262 ME
  791. X595 \tI
  792. X414 ED
  793. X5 G>
  794. X26 FA
  795. X40 YS
  796. X234 H\t
  797. X37 HT
  798. X14 (P
  799. X54 D.
  800. X53 AP
  801. X44 PU
  802. X22 .>
  803. X31 DG
  804. X4 OX
  805. X16 @S
  806. X12 SL
  807. X4 UF
  808. X1 _Z
  809. X31 'S
  810. X5 >@
  811. X2 _A
  812. X1 IQ
  813. X1 W'
  814. X311 VE
  815. X388 AR
  816. X10 G'
  817. X390 ND
  818. X478 IS
  819. X71 CL
  820. X184 DI
  821. X23 M.
  822. X62 BO
  823. X12 OA
  824. X39 EF
  825. X9 (R
  826. X72 \tK
  827. X2 .@
  828. X5 E_
  829. X1 \\L
  830. X13 .'
  831. X1 0S
  832. X2 @U
  833. X4 'U
  834. X2 SN
  835. X1 _C
  836. X1 GY
  837. X10 Q\t
  838. X1 \t\000
  839. X20 (T
  840. X494 AT
  841. X262 A\t
  842. X269 \tM
  843. X236 LL
  844. X136 RS
  845. X55 FE
  846. X11 NF
  847. X96 MI
  848. X4 YW
  849. X64 SP
  850. X70 OC
  851. X2 PY
  852. X6 Y>
  853. X13 Z\t
  854. X1 KO
  855. X2 M0
  856. X52 XA
  857. X5 EH
  858. X2 IU
  859. X1 P'
  860. X4 'W
  861. X2 TM
  862. X3 '>
  863. X4 .B
  864. X4 HX
  865. X1 @W
  866. X13 (\t
  867. X1 @>
  868. X13 (V
  869. X78 AV
  870. X87 VI
  871. X434 TO
  872. X59 RU
  873. X667 \tO
  874. X3 >_
  875. X129 UL
  876. X41 BS
  877. X296 HA
  878. X9 0>
  879. X1 PB
  880. X6 HZ
  881. X2 V0
  882. X5 SR
  883. X7 @@
  884. X2 Y@
  885. X3 F.
  886. X9 OE
  887. X2 XC
  888. X2 DM
  889. X3 Y'
  890. X1 '@
  891. X1 @'
  892. X9 J\t
  893. X1 @Y
  894. X1 \\P
  895. X1 >F
  896. X22 @B
  897. X86 FI
  898. X355 ST
  899. X1130 S\t
  900. X64 CR
  901. X176 WH
  902. X139 UN
  903. X70 BU
  904. X139 EL
  905. X77 DO
  906. X69 MM
  907. X10 PD
  908. X4 HC
  909. X16 XE
  910. X6 O.
  911. X35 OG
  912. X8 LP
  913. X9 KS
  914. X11 R>
  915. X14 RW
  916. X6 0'
  917. X6 _0
  918. X3 (X
  919. X2 'B
  920. X2 AX
  921. X27 \tQ
  922. X1 I'
  923. X5 YB
  924. X125 MO
  925. X556 \tS
  926. X1033 HE
  927. X160 CT
  928. X467 EN
  929. X109 TS
  930. X40 OI
  931. X74 GH
  932. X74 UP
  933. X98 RY
  934. X18 IB
  935. X4 B>
  936. X12 (A
  937. X48 C\t
  938. X3 P_
  939. X8 R'
  940. X2 ZA
  941. X12 NL
  942. X13 'D
  943. X1 _K
  944. X1 SV
  945. X1 @D
  946. X7 0B
  947. X7 \\\t
  948. X18 RB
  949. X47 EP
  950. X109 ID
  951. X298 L\t
  952. X73 BY
  953. X195 \tU
  954. X17 NN
  955. X151 AC
  956. X54 TU
  957. X4 _M
  958. X125 UR
  959. X21 H.
  960. X3 Y_
  961. X29 WL
  962. X30 PH
  963. X6 (C
  964. X59 DS
  965. X35 LT
  966. X12 OK
  967. X3 'F
  968. X16 VO
  969. X10 XI
  970. X5 JA
  971. X1 @F
  972. X7 0D
  973. X1 @_
  974. X21 T>
  975. X713 ER
  976. X93 RD
  977. X35 MS
  978. X53 SA
  979. X537 \tW
  980. X144 FO
  981. X273 HI
  982. X52 TW
  983. X149 UT
  984. X215 OM
  985. X56 DU
  986. X64 IF
  987. X27 WN
  988. X5 @H
  989. X28 GL
  990. X2 H0
  991. X5 0_
  992. X6 I_
  993. X6 NP
  994. X45 U\t
  995. X4 LV
  996. X6 _O
  997. X27 (E
  998. X13 ZE
  999. X5 K'
  1000. X1 BB
  1001. X1 KY
  1002. X3 'H
  1003. X2 AE
  1004. X7 0F
  1005. X12 \t>
  1006. X189 \t@
  1007. X30 JE
  1008. X109 \t'
  1009. X147 AG
  1010. X1892 E\t
  1011. X43 OO
  1012. X245 PL
  1013. X41 GN
  1014. X58 SC
  1015. X115 ET
  1016. X257 CA
  1017. X70 \tY
  1018. X2 \\A
  1019. X8 R_
  1020. X5 A.
  1021. X9 RF
  1022. X1 S\\
  1023. X4 D>
  1024. X56 MU
  1025. X2 Z.
  1026. X36 TY
  1027. X12 T'
  1028. X3 DW
  1029. X1 KB
  1030. X1 NR
  1031. X6 'J
  1032. X1 @J
  1033. X3 WP
  1034. X1 _Q
  1035. X17 M>
  1036. X4 J.
  1037. X575 N\t
  1038. X396 SE
  1039. X23 (I
  1040. X274 LA
  1041. X423 \tB
  1042. X357 NT
  1043. X50 AI
  1044. X74 EV
  1045. X17 CC
  1046. X15 DY
  1047. X34 WR
  1048. X3 RH
  1049. X5 (0
  1050. X16 _S
  1051. X5 FS
  1052. X5 XO
  1053. X14 D'
  1054. X5 HM
  1055. X2 ZI
  1056. X5 'L
  1057. X1 YL
  1058. X1 B_
  1059. X1 UX
  1060. X1 @L
  1061. X1 TB
  1062. X1 \\C
  1063. X36 AK
  1064. X112 EX
  1065. X286 >\t
  1066. X293 \tD
  1067. X64 OS
  1068. X141 IL
  1069. X135 HO
  1070. X178 S.
  1071. X33 FU
  1072. X61 W\t
  1073. X135 CE
  1074. X98 UA
  1075. X55 PP
  1076. X64 GR
  1077. X15 BH
  1078. X15 YN
  1079. X5 M'
  1080. X1 _U
  1081. X11 NV
  1082. X5 'N
  1083. X6 LC
  1084. X1 U(
  1085. X2 MY
  1086. X4 @N
  1087. X2 K_
  1088. X5 E(
  1089. X778 IN
  1090. X790 .\t
  1091. X203 SI
  1092. X303 \tF
  1093. X166 PR
  1094. X70 UC
  1095. X270 EA
  1096. X149 AM
  1097. X271 G\t
  1098. X13 BJ
  1099. X326 OU
  1100. X410 LE
  1101. X13 T_
  1102. X32 DD
  1103. X36 MB
  1104. X17 RL
  1105. X3 C.
  1106. X1 KH
  1107. X1 JK
  1108. X4 (M
  1109. X169 \t_
  1110. X9 'P
  1111. X1 GT
  1112. X5 S0
  1113. X1 EZ
  1114. X2 TF
  1115. X2 .T
  1116. X4 YP
  1117. X3 _W
  1118. X128 _>
  1119. X1 @P
  1120. X21 N(
  1121. X1274 TH
  1122. X21 L.
  1123. X102 NA
  1124. X148 EC
  1125. X55 UE
  1126. X154 OW
  1127. X99 BL
  1128. X3 _Y
  1129. X29 PT
  1130. X3 HS
  1131. X62 CI
  1132. X6 FY
  1133. X240 \tH
  1134. X25 IP
  1135. X13 ZO
  1136. X1 DF
  1137. X57 RN
  1138. X43 P\t
  1139. X37 D_
  1140. X6 (O
  1141. X10 SK
  1142. X6 C0
  1143. X9 NZ
  1144. X1 'R
  1145. X4 O>
  1146. X1 _@
  1147. X1 @R
  1148. X445 Y\t
  1149. X43 \tJ
  1150. X22 'T
  1151. X88 '\t
  1152. X2 DH
  1153. X99 IR
  1154. X204 LI
  1155. X132 EE
  1156. X52 UG
  1157. X53 CK
  1158. X109 NC
  1159. X5 _B
  1160. X3 X>
  1161. X83 WA
  1162. X13 JO
  1163. X10 SM
  1164. X13 YT
  1165. X32 HU
  1166. X1 M_
  1167. X38 @\t
  1168. X7 RP
  1169. X1 MF
  1170. X1 KL
  1171. X1 U.
  1172. X1 @T
  1173. X1 N\\
  1174. X63 EG
  1175. X341 \tL
  1176. X149 SO
  1177. X614 0\t
  1178. X288 AS
  1179. X39 GA
  1180. X188 NE
  1181. X124 E.
  1182. X363 IT
  1183. X68 OB
  1184. X30 RR
  1185. X47 TL
  1186. X55 KN
  1187. X35 I\t
  1188. X22 G(
  1189. X8 (S
  1190. X43 UI
  1191. X2 'V
  1192. X4 MH
  1193. X1 CM
  1194. X2 H>
  1195. X38 QU
  1196. X2 X@
  1197. X11 LK
  1198. X2 XY
  1199. X1 @V
  1200. X1 \\M
  1201. X1 W\\
  1202. X12 HY
  1203. X105 PA
  1204. X168 WE
  1205. X332 CO
  1206. X476 R\t
  1207. X80 OD
  1208. X59 IV
  1209. X47 EI
  1210. X459 NG
  1211. X131 \tN
  1212. X61 N.
  1213. X93 RT
  1214. X30 AU
  1215. X4 _F
  1216. X9 DL
  1217. X37 FF
  1218. X14 BR
  1219. X4 SQ
  1220. X2 H'
  1221. X1 (U
  1222. X372 __
  1223. X1 @X
  1224. X384 \tP
  1225. X342 OF
  1226. X202 GE
  1227. X33 >.
  1228. X131 SS
  1229. X145 LO
  1230. X21 JU
  1231. X118 NI
  1232. X63 UM
  1233. X2 HB
  1234. X12 IX
  1235. X7 AW
  1236. X1 ML
  1237. X2 .E
  1238. X2 _H
  1239. X17 TP
  1240. X27 B\t
  1241. X5 P\\
  1242. X2 PC
  1243. X5 @(
  1244. X3 W.
  1245. X2 O_
  1246. X13 RV
  1247. X11 (W
  1248. X3 DN
  1249. X4 BT
  1250. X4 'A
  1251. X1 EK
  1252. X3 CQ
  1253. X1 @A
  1254. X1 @Z
  1255. X148 TR
  1256. X221 \tR
  1257. X36 G.
  1258. X153 AY
  1259. X48 I(
  1260. X155 PE
  1261. X6 GG
  1262. X142 WI
  1263. X189 EM
  1264. X73 SU
  1265. X4 X_
  1266. X73 K\t
  1267. X27 IA
  1268. X2 Y\\
  1269. X26 ..
  1270. X4 @C
  1271. X7 CS
  1272. X18 IZ
  1273. X25 NK
  1274. X20 OH
  1275. X4 YC
  1276. X3 'C
  1277. X3 (Y
  1278. X2 MN
  1279. X1 ('
  1280. X2 BV
  1281. X7 0A
  1282. X1 @\\
  1283. X2 UO
  1284. X1 \\S
  1285. X1 \000\t
  1286. X3271 \t\t
  1287. X85 GI
  1288. X1646 \tT
  1289. X17 .0
  1290. X17 OJ
  1291. X701 T\t
  1292. X22 @E
  1293. X57 EO
  1294. X204 RA
  1295. X78 YE
  1296. X235 IC
  1297. X125 AB
  1298. X93 LS
  1299. X11 S>
  1300. X154 MP
  1301. X56 CU
  1302. X57 DR
  1303. X43 TT
  1304. X6 P.
  1305. X6 (B
  1306. X16 FL
  1307. X5 'E
  1308. X7 SW
  1309. X2 H_
  1310. X1 _L
  1311. X4 NM
  1312. X1 .I
  1313. X7 0C
  1314. X47 BA
  1315. X713 D\t
  1316. X125 \tV
  1317. X56 Y.
  1318. X3 _N
  1319. X134 NO
  1320. X198 US
  1321. X44 SY
  1322. X112 OL
  1323. X94 IE
  1324. X122 AD
  1325. X19 S'
  1326. X85 RC
  1327. X2 \\W
  1328. X24 LU
  1329. X13 PI
  1330. X7 (D
  1331. X1 C>
  1332. X9 EQ
  1333. X19 '.
  1334. X1 'G
  1335. X2 YG
  1336. X1 @G
  1337. X7 0E
  1338. X1 R\\
  1339. X1 @.
  1340. X497 ON
  1341. X31 0.
  1342. X631 RE
  1343. X465 ES
  1344. X94 IG
  1345. X49 @I
  1346. X17 YI
  1347. X143 M\t
  1348. X92 WO
  1349. X26 \tX
  1350. X3 _P
  1351. X5 I.
  1352. X3 (F
  1353. X5 '0
  1354. X3 KA
  1355. X7 CY
  1356. X5 @0
  1357. X4 A_
  1358. X5 LW
  1359. X8 AF
  1360. X2 DV
  1361. X6 'I
  1362. X4 L>
  1363. X2 C'
  1364. X2 TX
  1365. X2 NQ
  1366. X229 BE
  1367. X1432 00
  1368. X62 OP
  1369. X205 TA
  1370. X165 NS
  1371. X1047 \tA
  1372. X77 \t(
  1373. X151 LY
  1374. X61 R.
  1375. X42 FR
  1376. X18 RG
  1377. X20 GO
  1378. X3 T(
  1379. X2 (H
  1380. X1 HL
  1381. X1 U>
  1382. X5 EU
  1383. X30 _R
  1384. X10 L'
  1385. X1 II
  1386. X1 'K
  1387. X16 V\t
  1388. X1 VT
  1389. X2 @K
  1390. X9 \tZ
  1391. X9 @M
  1392. X65 KE
  1393. X56 DA
  1394. X91 PO
  1395. X21 D(
  1396. X483 \tC
  1397. X414 OR
  1398. X377 F\t
  1399. X51 E>
  1400. X7 SF
  1401. X177 RI
  1402. X29 NU
  1403. X13 WS
  1404. X21 TC
  1405. X20 FT
  1406. X29 EW
  1407. X3 AJ
  1408. X3 0K
  1409. X6 _T
  1410. X6 \\D
  1411. X43 _\t
  1412. X1 YM
  1413. X14 IK
  1414. X28 XP
  1415. X9 HN
  1416. X1 'M
  1417. X1 B.
  1418. X6 \t\\
  1419. X1 S_
  1420. X1 T\\
  1421. X184 MA
  1422. X446 TE
  1423. X179 IM
  1424. X114 OT
  1425. X79 SH
  1426. X335 AL
  1427. X513 O\t
  1428. X91 LD
  1429. X240 \tE
  1430. X43 UB
  1431. X92 BI
  1432. X33 EY
  1433. X3 D\\
  1434. X8 N>
  1435. X4 _V
  1436. X7 K.
  1437. X4 C_
  1438. X27 GS
  1439. X4 (L
  1440. X6 DC
  1441. X5 RK
  1442. X14 E'
  1443. X45 YO
  1444. X2 'O
  1445. X2 @O
  1446. X12 XT
  1447. X62 T.
  1448. X254 DE
  1449. X208 IO
  1450. X209 CH
  1451. X132 \tG
  1452. X606 AN
  1453. X33 NY
  1454. X7 EB
  1455. X67 OV
  1456. X29 HR
  1457. X31 X\t
  1458. X46 RM
  1459. X13 PS
  1460. X23 VA
  1461. X22 KI
  1462. X3 LF
  1463. X5 MC
  1464. X109 GU
  1465. X2 (N
  1466. X27 UD
  1467. X12 N'
  1468. X26 \t.
  1469. X1 L_
  1470. X1 @Q
  1471. END_OF_mss-bigram-old.stats
  1472. if test 4489 -ne `wc -c <mss-bigram-old.stats`; then
  1473.     echo shar: \"mss-bigram-old.stats\" unpacked with wrong size!
  1474. fi
  1475. # end of overwriting check
  1476. fi
  1477. if test -f perm.c -a "${1}" != "-c" ; then 
  1478.   echo shar: Will not over-write existing file \"perm.c\"
  1479. else
  1480. echo shar: Extracting \"perm.c\" \(4673 characters\)
  1481. sed "s/^X//" >perm.c <<'END_OF_perm.c'
  1482. X/*
  1483. X * Abstraction for the table of cipher text blocks and
  1484. X * their decoded permutations so far.
  1485. X *
  1486. X * Robert W. Baldwin, December 1984.
  1487. X */
  1488. X
  1489. X
  1490. X#include    <stdio.h>
  1491. X#include    "window.h"
  1492. X#include    "specs.h"
  1493. X
  1494. X
  1495. X#define    NPERLINE    10        /* How many values per line in save file. */
  1496. X#define    FROMSTART    0        /* For fseek call, how offset measured. */
  1497. X
  1498. X
  1499. X/* Input file name for permutations. */
  1500. Xchar    *permfile;
  1501. X
  1502. X
  1503. X/* Global state. */
  1504. Xint        permchgflg = FALSE;    /* True if perms changed since last save. */
  1505. Xint        *permtab[NPERMS];    /* Table of saved permutations or null. */
  1506. Xint        perminit = FALSE;    /* Initialization flag. */
  1507. X
  1508. X
  1509. X/* Allocate and clear a permutation.
  1510. X */
  1511. Xint    *permalloc()
  1512. X{
  1513. X    int        i;
  1514. X    int        *perm;
  1515. X
  1516. X    perm = ((int *) malloc((BLOCKSIZE+1)*sizeof(int)));
  1517. X    if (perm == NULL)  {
  1518. X        printf("\nNo room to allocate permutation.\n");
  1519. X        exit(0);
  1520. X        }
  1521. X
  1522. X    for (i = 0 ; i < BLOCKSIZE ; i++)  {
  1523. X        perm[i] = -1;
  1524. X        }
  1525. X
  1526. X    return(perm);
  1527. X}
  1528. X
  1529. X
  1530. X/* Return a pointer (for read or write use) to the permutation
  1531. X * for the given block number.
  1532. X * Return NULL if the block number is bad.
  1533. X */
  1534. Xint    *refperm(blocknum)
  1535. Xint    blocknum;
  1536. X{
  1537. X    int        i;
  1538. X
  1539. X    if ((blocknum < 0) || (NPERMS <= blocknum))  return(NULL);
  1540. X
  1541. X    if (!perminit) {
  1542. X        perminit = TRUE;
  1543. X        for (i = 0 ; i < NPERMS ; i++)  permtab[i] = NULL;
  1544. X        }
  1545. X
  1546. X    if (permtab[blocknum] == NULL)  {
  1547. X        permtab[blocknum] = permalloc();
  1548. X        }
  1549. X
  1550. X    return(permtab[blocknum]);
  1551. X}
  1552. X
  1553. X
  1554. X/* Save all the permutations in a file.
  1555. X * This can be invoked as a command.
  1556. X * For now, the are no arguments, the filename is fixed.
  1557. X * Return NULL if successful, else error mesage.
  1558. X * First the Zee matrix is dumped, then the permutations.
  1559. X * Each block is separated by a newline character.
  1560. X * Individual numbers are separated by blanks.
  1561. X */
  1562. Xchar    *permsave(str)
  1563. Xchar    *str;
  1564. X{
  1565. X    FILE    *fd;
  1566. X    int        i;
  1567. X
  1568. X    if ((fd = fopen(permfile, "w")) == NULL)  {
  1569. X        sprintf(statmsg, "Could not open %s to write permutations.", permfile);
  1570. X        return(statmsg);
  1571. X        }
  1572. X
  1573. X    storezee(fd);
  1574. X    
  1575. X    for (i = 0 ; i < NPERMS ; i++) {
  1576. X        writeperm(fd, refperm(i));
  1577. X        }
  1578. X
  1579. X    fclose(fd);
  1580. X    permchgflg = FALSE;
  1581. X    return(NULL);
  1582. X}
  1583. X
  1584. X
  1585. X/* Restore all the permutations by reading them from a file.
  1586. X * This can be invoked as a command.
  1587. X * For now, the are no arguments, the filename is fixed.
  1588. X * Return NULL if successful, else ptr to error message.
  1589. X * Also call dblock to update its display.
  1590. X */
  1591. Xchar    *permload(str)
  1592. Xchar    *str;
  1593. X{
  1594. X    FILE    *fd;
  1595. X    int        i;
  1596. X
  1597. X    if ((fd = fopen(permfile, "r")) == NULL)  {
  1598. X        sprintf(statmsg, "Could not open %s to read permutations.", permfile);
  1599. X        return(statmsg);
  1600. X        }
  1601. X
  1602. X    loadzee(fd);
  1603. X
  1604. X    for (i = 0 ; i < NPERMS ; i++) {
  1605. X        readperm(fd, refperm(i));
  1606. X        }
  1607. X
  1608. X    fclose(fd);
  1609. X    permchgflg = FALSE;
  1610. X
  1611. X    dbssetblk(&dbstore, dbsgetblk(&dbstore));    /* Update perm and cbuf. */
  1612. X
  1613. X    return(NULL);
  1614. X
  1615. X}
  1616. X
  1617. X
  1618. X
  1619. X/* Compute a permutation raised to some power.
  1620. X */
  1621. Xexpperm(srcperm, dstperm, power)
  1622. Xint    *srcperm, *dstperm;
  1623. Xint    power;
  1624. X{
  1625. X    int        i, k, v;
  1626. X
  1627. X    for (i = 0 ; i < BLOCKSIZE ; i++) {
  1628. X        v = i;
  1629. X        for (k = 0 ; k < power ; k++) {
  1630. X            v = srcperm[v];
  1631. X            if (v == -1)  break;
  1632. X            }
  1633. X        dstperm[i] = v;
  1634. X        }
  1635. X}
  1636. X
  1637. X
  1638. X/* Computer product of two permutations.
  1639. X */
  1640. Xmultperm(left, right, result)
  1641. Xint        *left;
  1642. Xint        *right;
  1643. Xint        *result;
  1644. X{
  1645. X    int        i, v;
  1646. X
  1647. X    for (i = 0 ; i < BLOCKSIZE ; i++) {
  1648. X        v = right[i];
  1649. X        if (v != -1)  v = left[v];
  1650. X        result[i] = v;
  1651. X        }
  1652. X}
  1653. X
  1654. X
  1655. X/* Write a permutation onto the given stream.
  1656. X */
  1657. Xwriteperm(fd, perm)
  1658. XFILE    *fd;
  1659. Xint        perm[];
  1660. X{
  1661. X    int        j;
  1662. X
  1663. X    for (j = 0 ; j < BLOCKSIZE ; j++)  {
  1664. X        fprintf(fd, "%3d ", perm[j]);
  1665. X        if ((j+1)%NPERLINE == 0)  fprintf(fd,"\n");
  1666. X        }
  1667. X
  1668. X    fprintf(fd,"\n");
  1669. X}
  1670. X
  1671. X
  1672. X
  1673. X/* Copy a permutation to another buffer.
  1674. X */
  1675. Xcopyperm(src, dst)
  1676. Xint        src[];
  1677. Xint        dst[];
  1678. X{
  1679. X    int        j;
  1680. X
  1681. X    for (j = 0 ; j < BLOCKSIZE ; j++)  {
  1682. X        dst[j] = src[j];
  1683. X        }
  1684. X}
  1685. X
  1686. X
  1687. X/* Read a permutation from the given stream into the given buffer.
  1688. X */
  1689. Xreadperm(fd, perm)
  1690. XFILE    *fd;
  1691. Xint        perm[];
  1692. X{
  1693. X    int        j;
  1694. X
  1695. X    for (j = 0 ; j < BLOCKSIZE ; j++)  {
  1696. X        fscanf(fd, "%3d", &perm[j]);
  1697. X        }
  1698. X
  1699. X    fscanf(fd,"\n");
  1700. X}
  1701. X
  1702. X
  1703. X/* Return a count of the number of values in the permutation that
  1704. X * are not equal to -1.
  1705. X * Max value is 256.
  1706. X */
  1707. Xint    permcount(perm)
  1708. Xint        perm[];
  1709. X{
  1710. X    int        i;
  1711. X    int        count;
  1712. X
  1713. X    count = 0;
  1714. X    for (i = 0 ; i < BLOCKSIZE ; i++)  {
  1715. X        if (perm[i] != -1)  count++;
  1716. X        }
  1717. X    return(count);
  1718. X}
  1719. X
  1720. X
  1721. X/* Return a count of the number of wires in a symetric permutation.
  1722. X * Return -1 if the permutation is not its own inverse or 
  1723. X * if it has fixed points.
  1724. X * Max value is 128.
  1725. X */
  1726. Xint    permwcount(perm)
  1727. Xint        perm[];
  1728. X{
  1729. X    int        i,v;
  1730. X    int        count;
  1731. X
  1732. X    count = 0;
  1733. X    for (i = 0 ; i < BLOCKSIZE ; i++)  {
  1734. X        v = perm[i];
  1735. X        if (v == -1) continue;
  1736. X        if (perm[v] != i)  return(-1);        /* Not self inverse. */
  1737. X        if (v == i)        return(-1);        /* Has fixed point. */
  1738. X        if (i < v)   continue;                /* Count first instance. */
  1739. X        count++;
  1740. X        }
  1741. X    return(count);
  1742. X}
  1743. END_OF_perm.c
  1744. if test 4673 -ne `wc -c <perm.c`; then
  1745.     echo shar: \"perm.c\" unpacked with wrong size!
  1746. fi
  1747. # end of overwriting check
  1748. fi
  1749. if test -f start.c -a "${1}" != "-c" ; then 
  1750.   echo shar: Will not over-write existing file \"start.c\"
  1751. else
  1752. echo shar: Extracting \"start.c\" \(4797 characters\)
  1753. sed "s/^X//" >start.c <<'END_OF_start.c'
  1754. X/*
  1755. X * Start up module for the crypt breaking editor.
  1756. X * Much of the global behavior of the program is set here.
  1757. X *
  1758. X * Robert W. Baldwin, December 1984.
  1759. X *
  1760. X * Bob Baldwin, 10/86:
  1761. X *  Added cmd to jump to user window.
  1762. X *  Handle C-Z to suspend CBW and abort commands.
  1763. X */
  1764. X
  1765. X
  1766. X#include    <stdio.h>
  1767. X#include    <signal.h>
  1768. X#include    <setjmp.h>
  1769. X#include    "window.h"
  1770. X#include    "terminal.h"
  1771. X#include    "layout.h"
  1772. X#include    "specs.h"
  1773. X
  1774. X
  1775. X/* Shell variable names. */
  1776. X#define    LETTERSTATS    "LETTERSTATS"
  1777. X#define    BIGRAMSTATS    "BIGRAMSTATS"
  1778. X#define    TRIGRAMSTATS    "TRIGRAMSTATS"
  1779. X
  1780. X#define    QUITMSG    "Permutations not saved.  Type 'y' if you want to quit."
  1781. X
  1782. X
  1783. X/* Keystroke behavior that is the same in all windows.
  1784. X */
  1785. Xextern        alldraw(), jumpcmd();
  1786. Xextern    char    *getenv();
  1787. X
  1788. Xkeyer    topktab[] = {
  1789. X        {CREFRESH, alldraw},
  1790. X        {CJUMPCMD, jumpcmd},
  1791. X        {0, NULL},
  1792. X        };
  1793. X
  1794. X
  1795. X/* Table of all top-level windows.  Terminated by NULL.
  1796. X */
  1797. Xgwindow        *wtable[WINDNUM+1];
  1798. Xchar        cfilebuf[100];
  1799. Xchar        pfilebuf[100];
  1800. X
  1801. X/* Saved stack state for suspending the program.
  1802. X */
  1803. Xjmp_buf        saved_stack;
  1804. X
  1805. X
  1806. Xmain(argc, argv)
  1807. Xint        argc;
  1808. Xchar    *argv[];
  1809. X{
  1810. X    extern    stop_handler();
  1811. X    extern    kill_handler();
  1812. X    char    *q, *pp, *pc;
  1813. X
  1814. X    if (argc < 2)  {
  1815. X        printf("Usage: %s FileNameRoot\n", argv[0]);
  1816. X        printf("\tThe extensions .cipher and .perm will be used.");
  1817. X        printf("\n\tThe shell variables");
  1818. X        printf(" %s, %s, %s,", LETTERSTATS, TRIGRAMSTATS, BIGRAMSTATS);
  1819. X        printf("\n\tand TERM must be defined.");
  1820. X        printf("\n\tThe shell variables");
  1821. X        printf(" %s and %s", GRAPHICSVAR, KEYMAPVAR);
  1822. X        printf(" may be defined.");
  1823. X        printf("\n");
  1824. X        exit(0);
  1825. X        }
  1826. X    q = argv[1];
  1827. X    pc = cipherfile = cfilebuf;
  1828. X    pp = permfile = pfilebuf;
  1829. X    while (*pp++ = *pc++ = *q++);
  1830. X    pp--;
  1831. X    pc--;
  1832. X    q = ".cipher";
  1833. X    while (*pc++ = *q++);
  1834. X    q = ".perm";
  1835. X    while (*pp++ = *q++); 
  1836. X
  1837. X    load_tables();
  1838. X
  1839. X    set_term();
  1840. X    signal(SIGTSTP, stop_handler);
  1841. X    signal(SIGINT, kill_handler);
  1842. X
  1843. X    initwindows();
  1844. X
  1845. X    /* Control returns here when program restarted after C-Z. */
  1846. X     setjmp(saved_stack);
  1847. X
  1848. X    alldraw();
  1849. X    usrstatus(&user, "Ready.");
  1850. X    usrfirst(&user, 1, 1);        /* Start in user window. */
  1851. X    
  1852. X    wl_driver(wtable);
  1853. X    done(0);            /* Fell off windows, we're done. */
  1854. X}
  1855. X
  1856. X
  1857. X/* Handle C-Z signal (suspend program).
  1858. X * Restore screen and exit.
  1859. X * On restart, setup screen, redraw screen, and abort to top loop.
  1860. X */
  1861. Xstop_handler()
  1862. X{
  1863. X    setcursor(MAXHEIGHT, 1);
  1864. X    fflush(stdout);
  1865. X    unset_term();
  1866. X    
  1867. X    kill(getpid(), SIGSTOP);
  1868. X
  1869. X    /* Return here when/if program restarted. */
  1870. X    /* Note that the signal mask is restored by longjmp. */
  1871. X    set_term();
  1872. X    longjmp(saved_stack, 0);
  1873. X}
  1874. X
  1875. X
  1876. X/* Handle C-C signal (kill program).
  1877. X * Restore screen and exit.
  1878. X */
  1879. Xkill_handler()
  1880. X{
  1881. X    setcursor(MAXHEIGHT, 1);
  1882. X    printf("\n");
  1883. X    fflush(stdout);
  1884. X    unset_term();
  1885. X    
  1886. X    kill(getpid(), SIGKILL);
  1887. X}
  1888. X
  1889. X
  1890. X/* Load stat tables.
  1891. X */
  1892. Xload_tables()
  1893. X{
  1894. X    printf("\n\nLoading letter statistics ...");
  1895. X    fflush(stdout);
  1896. X    if ((letterstats = getenv(LETTERSTATS)) == NULL)  {
  1897. X        printf("The shell variable %s is not defined.\n", LETTERSTATS);
  1898. X        exit(0);
  1899. X        }
  1900. X    load_1stats_from(letterstats);
  1901. X    printf(" done.\n");
  1902. X
  1903. X    printf("\n\nLoading bigram statistics ...");
  1904. X    fflush(stdout);
  1905. X    if ((bigramstats = getenv(BIGRAMSTATS)) == NULL)  {
  1906. X        printf("The shell variable %s is not defined.\n", BIGRAMSTATS);
  1907. X        exit(0);
  1908. X        }
  1909. X    load_2stats_from(bigramstats);
  1910. X    printf(" done.\n");
  1911. X
  1912. X    printf("\n\nLoading trigram statistics ...");
  1913. X    fflush(stdout);
  1914. X    if ((trigramstats = getenv(TRIGRAMSTATS)) == NULL)  {
  1915. X        printf("The shell variable %s is not defined.\n",TRIGRAMSTATS);
  1916. X        exit(0);
  1917. X        }
  1918. X    load_tri_from(trigramstats);
  1919. X    printf(" done.\n");
  1920. X    
  1921. X    permchgflg = FALSE;
  1922. X}
  1923. X
  1924. X
  1925. X/* Quit command
  1926. X * This is the prefered way to leave the program.
  1927. X */
  1928. Xchar *quitcmd(arg)
  1929. Xchar    *arg;
  1930. X{
  1931. X    char    c;
  1932. X
  1933. X    if (permchgflg)  {
  1934. X        usrstatus(&user, QUITMSG);
  1935. X        c = getchar();
  1936. X        if (!(c == 'y'  ||  c == 'Y'))
  1937. X              return(NULL);
  1938. X        }
  1939. X    done(0);
  1940. X}
  1941. X
  1942. X
  1943. X/* Exit the program after cleaning up the terminal.
  1944. X */
  1945. Xdone(status)
  1946. Xint    status;
  1947. X{
  1948. X    unset_term();
  1949. X    printf("\n");
  1950. X    exit(status);
  1951. X}
  1952. X
  1953. X
  1954. X/* (re)Draw all the windows.
  1955. X */
  1956. Xalldraw()
  1957. X{
  1958. X    wl_refresh(wtable);
  1959. X}
  1960. X
  1961. X
  1962. X/* Jump to the command window.
  1963. X * Tell the current window, that it is losing the cursor, and
  1964. X * then tell the user window that it's got the cursor.
  1965. X */
  1966. Xjumpcmd(w)
  1967. Xgwindow    *w;
  1968. X{
  1969. X    (*(w->wlast))(w);
  1970. X    usrfirst(&user, 1, 1);        /* Given row, col ignored. */
  1971. X}
  1972. X
  1973. X
  1974. X/* Fill in the window table.
  1975. X */
  1976. Xinitwindows()
  1977. X{
  1978. X    int    i;
  1979. X
  1980. X    i = 0;
  1981. X    wtable[i++] = iuser();
  1982. X    wtable[i++] = ibanner();
  1983. X    wtable[i++] = idblabel();
  1984. X    wtable[i++] = idbstore();
  1985. X    wtable[i++] = igblabel();
  1986. X    wtable[i++] = igbstore();
  1987. X    wtable[i++] = iwebster();
  1988. X
  1989. X    if (i != WINDNUM)  {
  1990. X        disperr("inittables: WINDNUM value is wrong");
  1991. X        setcursor(2,1);
  1992. X        exit(0);
  1993. X        }
  1994. X
  1995. X    wtable[i] = ((gwindow *) NULL);
  1996. X}
  1997. X
  1998. X
  1999. X/* Get keystroke routine.
  2000. X * Responsible for clearing the status area before every keystroke.
  2001. X */
  2002. Xkey    u_getkey()
  2003. X{
  2004. X    key    k;
  2005. X
  2006. X    k = getcmd();
  2007. X    usrstatus(&user, "");
  2008. X
  2009. X    return(k);
  2010. X}
  2011. END_OF_start.c
  2012. if test 4797 -ne `wc -c <start.c`; then
  2013.     echo shar: \"start.c\" unpacked with wrong size!
  2014. fi
  2015. # end of overwriting check
  2016. fi
  2017. if test -f terminal.h -a "${1}" != "-c" ; then 
  2018.   echo shar: Will not over-write existing file \"terminal.h\"
  2019. else
  2020. echo shar: Extracting \"terminal.h\" \(4892 characters\)
  2021. sed "s/^X//" >terminal.h <<'END_OF_terminal.h'
  2022. X/*
  2023. X * Definitions for terminals (symbols, graphics, keystroke, commands).
  2024. X *
  2025. X * Author: Bob Baldwin, October 1986.
  2026. X */
  2027. X
  2028. X
  2029. X/* Names of shell variables for keystroke map and symbol map.
  2030. X */
  2031. X#define    GRAPHICSVAR    "GRAPHICSMAP"
  2032. X#define    KEYMAPVAR    "KEYMAP"
  2033. X
  2034. X
  2035. X/* Screen control strings from termcap entry.
  2036. X */
  2037. Xextern    char    *term_is;        /* Terminal initializaion string. */
  2038. Xextern    char    *erase_eol;        /* Erase to end of line. */
  2039. Xextern    char    *erase_eos;        /* Erase to end of screen. */
  2040. Xextern    char    *erase_scr;        /* Erase whole screen. */
  2041. Xextern    char    *cm;            /* Cursor motion. */
  2042. Xextern    char    *start_alt;        /* Start graphics mode. */
  2043. Xextern    char    *end_alt;        /* End graphics mode. */
  2044. Xextern    char    *start_so;        /* Start standout mode. */
  2045. Xextern    char    *end_so;        /* End standout mode. */
  2046. Xextern    char    *start_kp;        /* Start send keypad escapes. */
  2047. Xextern    char    *end_kp;        /* End send keypad escapes. */
  2048. X
  2049. X/* Keymap strings from termcap file.
  2050. X */
  2051. Xextern    char    *term_f1;        /* The f1 key. */
  2052. Xextern    char    *term_f2;        /* The f2 key. */
  2053. Xextern    char    *term_f3;        /* The f3 key. */
  2054. Xextern    char    *term_f4;        /* The f4 key. */
  2055. Xextern    char    *term_up;        /* Up arrow. */
  2056. Xextern    char    *term_down;        /* Down arrow. */
  2057. Xextern    char    *term_left;        /* Left arrow. */
  2058. Xextern    char    *term_right;        /* Right arrow. */
  2059. X
  2060. X
  2061. X/* Flag values
  2062. X */
  2063. X#define    CHARM        0377        /* Mask for 8 bit chars. */
  2064. X#define SYMBOL        128        /* OR'ed with symbol codes. */
  2065. X#define    SYMBOLM        (SYMBOL - 1)    /* Mask for symbol codes. */
  2066. X
  2067. X
  2068. X/* Symbol codes.
  2069. X * These can be used as array indices if the SYMBOL bit is stripped.
  2070. X */
  2071. X#define    STAB        (0 | SYMBOL)    /* Tab character. */
  2072. X#define    SNOTASCII    (1 | SYMBOL)    /* Byte with high bit set. */
  2073. X#define    SLINEFEED    (2 | SYMBOL)    /* Linefeed character. */
  2074. X#define    SCARETURN    (3 | SYMBOL)    /* Return character. */
  2075. X#define    SFORMFEED    (4 | SYMBOL)    /* Formfeed character. */
  2076. X#define    SCONTCODE    (5 | SYMBOL)    /* Other control characters. */
  2077. X#define    SUNKNOWN    (6 | SYMBOL)    /* Character decryption unknown. */
  2078. X#define    SUNDERLINE    (7 | SYMBOL)    /* Pseudo underline symbol, it */
  2079. X                        /* highlights char on prev line. */
  2080. X#define    SVERTBAR    (8 | SYMBOL)    /* Vertical bar. */
  2081. X#define    SHORZBAR    (9 | SYMBOL)    /* Horizontal bar. */
  2082. X#define    SLLCORNER    (10 | SYMBOL)    /* Lower-left corner. */
  2083. X#define    NSYMC         11        /* Number of symbol codes. */
  2084. X
  2085. X
  2086. X/* Default graphics settings, in the format of the shell variable.
  2087. X * Extra spaces, tabs and colons are for testing.
  2088. X * Entries are separated by spaces, tabs, or colons, and
  2089. X * terminated by colon or NULL.
  2090. X */
  2091. X#define    VARSEP        "\t \n:"
  2092. X#define    VARTERM        ":"
  2093. X#define    GVARMODES    "NGS"        /* From s_mode values */
  2094. X#define    DGRAPHICS    "tb=\\St:na=\\SX: lf=\\Sn:cr=\\Sr:    :\
  2095. X              ff=\\Sf:cc=\\SC:uk=\\S :::ul=\\N^:\
  2096. X              hb=\\N-:vb=\\N|:ll=\\N`"
  2097. X
  2098. X
  2099. X/* Structure of symbol to graphics table.
  2100. X * The s_seq strings are allocated from the heap during init.
  2101. X * The table graphtab is indexed by the symbol code.
  2102. X */
  2103. X#define    SMNORMAL    'N'    /* Values for s_mode. */
  2104. X#define    SMGRAPHIC    'G'
  2105. X#define    SMSTANDOUT    'S'
  2106. X#define    symgraph    struct symgraphx
  2107. Xsymgraph    {
  2108. X    int    s_mode;            /* Symbol display mode. */
  2109. X    char    *s_seq;            /* Chars to send in that mode. */
  2110. X};
  2111. X
  2112. X
  2113. X/* Command codes.
  2114. X * These are not intended to be used as array indices.
  2115. X * Note problem with CNONE.
  2116. X */
  2117. X#define    CMDSHIFT    8        /* Commands in high byte. */
  2118. X#define    CMDMASK        0377        /* Mask to get cmd code. */
  2119. X#define    CNONE        0        /* Not a command. */
  2120. X#define    CGO_UP        1        /* Sames as jogcursor() arg. */
  2121. X#define    CGO_DOWN    2
  2122. X#define    CGO_LEFT    3
  2123. X#define CGO_RIGHT    4
  2124. X#define    CREFRESH    5        /* Refresh screen. */
  2125. X#define    CUNDO        6        /* Undo guess. */
  2126. X#define    CCLRLINE    7        /* Clear whole line. */
  2127. X#define    CWRDSRCH    8        /* Search for word. */
  2128. X#define    CDELF        9        /* Delete forward. */
  2129. X#define    CDELB        10        /* Delete backward. */
  2130. X#define    CPREVBLOCK    11        /* Goto previous block. */
  2131. X#define CNEXTBLOCK    12        /* Goto next block. */
  2132. X#define    CNEXTGUESS    12        /* Next guess. */
  2133. X#define CNEXTARG    12        /* Goto next arg in template. */
  2134. X#define    CACCEPT        13        /* Accept guess. */
  2135. X#define    CEXECUTE    14        /* Execute a command. */
  2136. X#define    CRETURN        14        /* Insert a return char. */
  2137. X#define    CINSERT        15        /* Insert the arg char. */
  2138. X#define    CTRYALL        16        /* Try all chars here. */
  2139. X#define    CJUMPCMD    17        /* Jump to cmd line. */
  2140. X
  2141. X
  2142. X/* See cmdnames[] for a list of the field labels in the default keymap.
  2143. X */
  2144. X#define    DKEYMAP        "ta=\024:up=\020:do=\016:le=\002:ri=\006:\
  2145. X              re=\014:un=\007:cl=\025:ws=\027:\
  2146. X              df=\\004:db=\177:jc=\030:ex=\\n:\
  2147. X              pr=\022:ne=\023:ac=\001"
  2148. X
  2149. X
  2150. X/* Structure of key command table.
  2151. X * The c_seq strings are allocated from the heap during init.
  2152. X */
  2153. X#define    keycmd    struct keycmdx
  2154. Xkeycmd    {
  2155. X    int    c_code;            /* Command code. */
  2156. X    char    *c_seq;            /* Chars in keystroke. */
  2157. X};
  2158. X
  2159. X
  2160. X/* Structure for parsing shell variables in a format like termcap.
  2161. X * The last entry in a table of these has label == NULL.
  2162. X */
  2163. X#define    labelv    struct    labelvx
  2164. Xlabelv    {
  2165. X    char    *label;        /* Label string. */
  2166. X    int    value;        /* Arbitrary value for label. */
  2167. X};
  2168. X
  2169. X
  2170. X#define    DIGITS    "0123456789"
  2171. END_OF_terminal.h
  2172. if test 4892 -ne `wc -c <terminal.h`; then
  2173.     echo shar: \"terminal.h\" unpacked with wrong size!
  2174. fi
  2175. # end of overwriting check
  2176. fi
  2177. if test -f test2.txt -a "${1}" != "-c" ; then 
  2178.   echo shar: Will not over-write existing file \"test2.txt\"
  2179. else
  2180. echo shar: Extracting \"test2.txt\" \(4316 characters\)
  2181. sed "s/^X//" >test2.txt <<'END_OF_test2.txt'
  2182. Xtherefore, each IPC message from an Eject to the Eden kernel, and vice
  2183. Xversa, involves at least a Unix process switch and copying the IPC
  2184. Xmessage into and out of the Unix kernel.
  2185. X
  2186. XThe first versions of Eden required 14 IPC messages to be sent per
  2187. Xlocal invocation.  A local invocation occurs when the invoking Eject
  2188. Xand the target Eject reside on the same physical machine.
  2189. XWhat was 2-process kernel's role in this setup?
  2190. X
  2191. XThe 2-process Eden kernel was finally replaced by a 1-process Eden
  2192. Xkernel, immediately reducing the number of messages required for an
  2193. Xinvocation by eliminating the IPC messages between the two kernel
  2194. Xprocesses.
  2195. X
  2196. XThe final reduction in IPC messages sent per invocation occurred
  2197. Xduring the summer of 1984.  Two more IPC messages were eliminated.
  2198. XOne of the messages eliminated was the IPC message from the Eden
  2199. Xkernel to the invoking Eject that communicated the {\it invocation
  2200. Xhandle} assigned to that particular call.  It was replaced by a scheme
  2201. Xwhere the invoking Eject was allowed to generate its own {\it local
  2202. Xinvocation handle} to communicate with the Eden kernel, and the Eden
  2203. Xkernel would generate its own unique handle in order to communicate
  2204. Xwith another Eden kernel or the target Eject.  The Eden kernel
  2205. Xguarantees that the reply message to an invocation will be stamped
  2206. Xwith the invoking Eject-generated handle.  The other IPC message
  2207. Xeliminated was the status message from the Eden kernel to the target
  2208. XEject confirming the kernel's approval of the reply message (format,
  2209. Xor contents if capabilities were contained in the reply).  The more
  2210. Xlogical scheme of notifying the invoking Eject of the failure status
  2211. Xof the reply, or the actual reply if the status was success, is now
  2212. Xbeing used.  The result of all these improvements is shown in figure
  2213. X\ref{oldfig}.  (See section \ref{oldexp} for an explanation of figure
  2214. X\ref{oldfig}.)
  2215. X
  2216. X\section{Related Work}\label{introrel}
  2217. X
  2218. XNelson's thesis thoroughly examines remote procedure calls.  He
  2219. Xstudies a number of implementations, and proposes a design for
  2220. XEmmisary(?), a new RPC mechanism with excellent transparency and
  2221. Xexceptional performance.  To attain exceptional performance, Nelson
  2222. Xgives a list of "lessons" that an RPC mechanism must have.  The
  2223. Xlessons are summarized here for the reader:
  2224. X
  2225. X\begin{itemize}
  2226. X\end{itemize}
  2227. X
  2228. XIn designing an RPC mechanism, it is convenient to use a layer model.
  2229. XHowever, strict adherance to the layer model often results in poor
  2230. Ximplementations.  There is a prohibitive cost associated with highly
  2231. Xmodular implementations that cannot be tolerated in RPC
  2232. Ximplementations.  In proposing a solution to the asynchrony
  2233. Xproblem, Cooper\cite{soft} advocates "soft layering".  The idea of soft
  2234. Xlayering may be applied to any naturally layered system whose layers
  2235. Xmust work well together.
  2236. X
  2237. X\section{Structure of Thesis}\label{introstruct}
  2238. X
  2239. XChapter \ref{old} examines the deficiencies of the current Eden
  2240. Xinvocation mechanism.  The reader is taken on a tour through the
  2241. Xprocess of initiating an invocation and receiving its reply, and
  2242. Xreceiving a new invocation and replying to the invocation.
  2243. X
  2244. XChapter \ref{new} proposes restructuring the dispatcher module for
  2245. Xsynchronous invocations (by far the most heavily used form of
  2246. Xcommunication within Eden) and breaking down the "hard layering" that
  2247. Xcurrently exists between the various layers that support invocations,
  2248. Xfrom the Eject's point of view, in order to obtain significant
  2249. Xperformance gains.
  2250. X
  2251. X\chapter{A Closer Look at the Eden Invocation Mechanism}\label{old}
  2252. X
  2253. X\section{The Dispatcher -- Interface and Internals}\label{olddis}
  2254. X
  2255. X\section{Flow of Data -- CIP, Stub, and ESCII}\label{olddat}
  2256. X
  2257. X\section{Summary}\label{oldsum}
  2258. X
  2259. X\chapter{An Alternative Synchronous Invocation Mechanism}\label{new}
  2260. X
  2261. X\section{Assumptions and Limitations}\label{newass}
  2262. X
  2263. X\section{The Dispatcher -- Interface and Internals}\label{newdis}
  2264. X
  2265. X\section{A Word About Buffer Management}\label{newbuf}
  2266. X
  2267. X\section{Flow of Data -- CIP, Stub, and ESCII}\label{newdat}
  2268. X
  2269. X\section{Results and Timings}\label{newres}
  2270. X
  2271. X\section{Summary}\label{newsum}
  2272. X
  2273. X\chapter{Conclusions and Further Work}\label{concl}
  2274. X
  2275. X\section{Lessons Re-learned}\label{conles}
  2276. X
  2277. X\section{Soft Layering}\label{conlay}
  2278. X
  2279. X\section{Modularization and Interfaces}\label{conmod}
  2280. X
  2281. X\section{Further Work}\label{confur}
  2282. X
  2283. X\end{document}
  2284. X
  2285. END_OF_test2.txt
  2286. if test 4316 -ne `wc -c <test2.txt`; then
  2287.     echo shar: \"test2.txt\" unpacked with wrong size!
  2288. fi
  2289. # end of overwriting check
  2290. fi
  2291. if test -f webster.c -a "${1}" != "-c" ; then 
  2292.   echo shar: Will not over-write existing file \"webster.c\"
  2293. else
  2294. echo shar: Extracting \"webster.c\" \(4720 characters\)
  2295. sed "s/^X//" >webster.c <<'END_OF_webster.c'
  2296. X/*
  2297. X * Pattern matching on words in a dictionary.
  2298. X * Patterns are entered as command arguments and results are
  2299. X * displayed in this window.
  2300. X *
  2301. X * Robert W. Baldwin, December 1984.
  2302. X */
  2303. X
  2304. X
  2305. X#include    <stdio.h>
  2306. X#include    "window.h"
  2307. X#include    "terminal.h"
  2308. X#include    "layout.h"
  2309. X#include    "specs.h"
  2310. X
  2311. X
  2312. X#define    DICTNAME    "/usr/dict/words"
  2313. X#define    DICTVAR        "DICTIONARY"    /* Name of shell var. */
  2314. X#define    WEBHELP        "Word match is invoked using the 'lookup' command"
  2315. X#define    TOPINDEX    2
  2316. X#define    BOTINDEX    (WEBHEIGHT-2)
  2317. X
  2318. Xextern    int    wordsim();    /* Defined below. */
  2319. Xextern        web_first();    /* Defined below. */
  2320. X
  2321. X/* Strings for outlining the window.
  2322. X */
  2323. Xchar    *webhead = "| Word Match";
  2324. Xchar    *webpane = "|";
  2325. Xchar    *webbot  = "`-------------------------";
  2326. X
  2327. X/* Window for the list of matches. */
  2328. X
  2329. Xdispline webaline[WEBHEIGHT];        /* Display lines for the history. */
  2330. Xdispline *weblines[WEBHEIGHT+1];    /* Pointers to them plus NULL. */
  2331. X
  2332. Xtwindow  webster = {
  2333. X        WEBROW,WEBCOL,        /* Origin. */
  2334. X        WEBHEIGHT,WEBWIDTH,    /* Height and width. */
  2335. X        1,1,            /* Initial (relative) cursor pos. */
  2336. X        NULL,            /* No private data. */
  2337. X        web_first,        /* Firstime = accept cursor pos. */
  2338. X        wl_noop,        /* Lasttime = do nothing. */
  2339. X        wl_twdraw,        /* Default draw routine. */
  2340. X        dokey,            /* Default keystroke handler. */
  2341. X        arwktab,        /* Basic arrow keystroke handler. */
  2342. X        weblines,
  2343. X};
  2344. X
  2345. X
  2346. X
  2347. X/* Make a window with a title and partial outline.
  2348. X */
  2349. Xgwindow *(iwebster())
  2350. X{
  2351. X    int        i;
  2352. X    displine    *line;
  2353. X
  2354. X    webgraphics(webhead);
  2355. X    webgraphics(webpane);
  2356. X    webgraphics(webbot);
  2357. X
  2358. X    for (i = 0 ; i < WEBHEIGHT ; i++)  {
  2359. X        line = &webaline[i];
  2360. X        line->worg_row = webster.worg_row + i;
  2361. X        line->worg_col = webster.worg_col;
  2362. X        line->wheight = 1;
  2363. X        line->wwidth = webster.wwidth;
  2364. X        line->wcur_row = 1;
  2365. X        line->wcur_col = 1;
  2366. X        line->wfirst = wl_noop;
  2367. X        line->wlast = wl_noop;
  2368. X        line->wredraw = wl_dldraw;
  2369. X        line->wkey = dokey;
  2370. X        line->wkeyprocs = arwktab;
  2371. X        line->dl_min_col = 2;
  2372. X        line->dl_max_col = webster.wwidth;
  2373. X        setadline(line, webpane);
  2374. X        webster.dlines[i] = line;
  2375. X        }
  2376. X    webster.dlines[i] = NULL;
  2377. X
  2378. X    line = &webaline[0];
  2379. X    setadline(line, webhead);
  2380. X    line = &webaline[i - 1];
  2381. X    setadline(line, webbot);    /* Truncates to fit. */
  2382. X    return((gwindow *) &webster);
  2383. X}
  2384. X
  2385. X
  2386. X/* Convert a default graphic chars to fancy graphics chars
  2387. X * in the given string.
  2388. X */
  2389. Xwebgraphics(str)
  2390. Xchar    *str;
  2391. X{
  2392. X    for ( ; *str != NULL ; str++)  {
  2393. X        switch (*str)  {
  2394. X          default:
  2395. X            break;
  2396. X
  2397. X          case '|':
  2398. X            *str = SVERTBAR;
  2399. X            break;
  2400. X
  2401. X          case '-':
  2402. X            *str = SHORZBAR;
  2403. X            break;
  2404. X
  2405. X          case '`':
  2406. X            *str = SLLCORNER;
  2407. X            break;
  2408. X        }
  2409. X    }
  2410. X}
  2411. X
  2412. X
  2413. X/* Command to lookup word pattern in dictionary.
  2414. X * The pattern contains letters and dots.  The dots match any character.
  2415. X */
  2416. Xchar *webmatch(args)
  2417. Xchar    *args;
  2418. X{
  2419. X    char    *p, *w;        /* Pattern and word pointers. */
  2420. X    char    patbuf[MAXWIDTH+1];
  2421. X    char    wordbuf[MAXWIDTH+1];
  2422. X    int    i;
  2423. X    char    *bufptr;
  2424. X    int    row,col;
  2425. X    FILE    *fd;
  2426. X    displine *line;
  2427. X    int    nextline;    /* Index of next line to put result. */
  2428. X    char    *dictfile;
  2429. X    extern    char    *getenv();
  2430. X
  2431. X    row = rowcursor();
  2432. X    col = colcursor();
  2433. X
  2434. X    if ((i = sscanf(args,"%*[^:]: %s", patbuf)) != 1) {
  2435. X        sprintf(statmsg, "Error, got %d args not 1. From: %s", i,args);
  2436. X        return(statmsg);    /* Beware: this returns a pointer to the stack. */
  2437. X        }
  2438. X    line = webster.dlines[TOPINDEX-1];
  2439. X    dlsetvar(line, patbuf);
  2440. X
  2441. X    for (nextline = TOPINDEX ; nextline <= BOTINDEX ; nextline++) {
  2442. X        line = webster.dlines[nextline];
  2443. X        dlsetvar(line, "");
  2444. X        }
  2445. X    wl_draw(&webster);
  2446. X    setcursor(row, col);
  2447. X    fflush(stdout);
  2448. X
  2449. X    dictfile = getenv(DICTVAR);
  2450. X    if (dictfile == NULL)
  2451. X          dictfile = DICTNAME;
  2452. X
  2453. X    if ((fd = fopen(dictfile, "r")) == NULL)  {
  2454. X        sprintf(statmsg, "Could not open %s to read dictionary.",
  2455. X            dictfile);
  2456. X        return(statmsg);
  2457. X        }
  2458. X
  2459. X    for (nextline = TOPINDEX ; nextline <= BOTINDEX ; nextline++) {
  2460. X        line = webster.dlines[nextline];
  2461. X        while (TRUE) {
  2462. X            bufptr = fgets(wordbuf, MAXWIDTH+1, fd);
  2463. X            if (bufptr != wordbuf) {
  2464. X                wordbuf[0] = '\000';
  2465. X                goto alldone;
  2466. X                }
  2467. X            if (wordsim(patbuf, wordbuf)) break;
  2468. X            }
  2469. X        for (w=wordbuf ; *w != '\n' ; w++) {}
  2470. X        *w = '\000';
  2471. X        dlsetvar(line, wordbuf);
  2472. X        wl_draw(line);
  2473. X        setcursor(row, col);
  2474. X        fflush(stdout);
  2475. X        }
  2476. X
  2477. Xalldone:
  2478. X    fclose(fd);
  2479. X
  2480. X    return(NULL);
  2481. X}
  2482. X
  2483. X
  2484. X/* Return TRUE if the pattern matches the word
  2485. X */
  2486. Xint    wordsim(pattern, word)
  2487. Xchar    *pattern;
  2488. Xchar    *word;
  2489. X{
  2490. X    for ( ; *pattern != 0 && *word != 0 ; ((int)pattern++)|((int)word++)) {
  2491. X        if (*word == '\n')
  2492. X              return(FALSE);
  2493. X        if (*pattern == '.')
  2494. X              continue;
  2495. X        if (*pattern != *word)
  2496. X              return(FALSE);
  2497. X        }
  2498. X    if (*pattern == 0 && *word == '\n')
  2499. X          return(TRUE); /* Same length */
  2500. X    return(FALSE);
  2501. X}
  2502. X
  2503. X
  2504. X/* Called when cursor enters the window.
  2505. X * Clears the help message and accepts the cursor position.
  2506. X */
  2507. Xweb_first(w, row, col)
  2508. Xgwindow    *w;
  2509. Xint        row, col;
  2510. X{
  2511. X    wl_setcur(w, row, col);
  2512. X    usrhelp(&user, WEBHELP);
  2513. X}
  2514. END_OF_webster.c
  2515. if test 4720 -ne `wc -c <webster.c`; then
  2516.     echo shar: \"webster.c\" unpacked with wrong size!
  2517. fi
  2518. # end of overwriting check
  2519. fi
  2520. if test -f windowlib.c -a "${1}" != "-c" ; then 
  2521.   echo shar: Will not over-write existing file \"windowlib.c\"
  2522. else
  2523. echo shar: Extracting \"windowlib.c\" \(4375 characters\)
  2524. sed "s/^X//" >windowlib.c <<'END_OF_windowlib.c'
  2525. X/*
  2526. X * Library of window routines.
  2527. X *
  2528. X * Robert W. Baldwin, December 1984.
  2529. X */
  2530. X
  2531. X#include    <stdio.h>
  2532. X#include    "window.h"
  2533. X#include    "specs.h"
  2534. X
  2535. X
  2536. X/* The external topktab must be filled in by the application.
  2537. X * It specifies the keystroke behavior that is the same in
  2538. X * all windows.  For example, the refresh function can be handled here.
  2539. X * It should be terminated by a keychar == 0, not -1, so the
  2540. X * active window will get a chance to handle the key.
  2541. X */
  2542. Xextern    keyer    topktab[];
  2543. X
  2544. X
  2545. X/* This external must be a routine that gets and returns
  2546. X * a keystroke (integer) without taking any arguments.
  2547. X */
  2548. Xextern    key        u_getkey();
  2549. X
  2550. X
  2551. X
  2552. X/* This is the main loop that runs the window system.
  2553. X * It returns if the cursor is not in any of the windows in wtab.
  2554. X */
  2555. Xwl_driver(wtab)
  2556. Xgwindow        *wtab[];        /* Ptr to null terminated list of windows. */
  2557. X{
  2558. Xgwindow        **pw, *w;
  2559. Xint            lrow, lcol;        /* Cursor location relative to window. */
  2560. Xkey            k;
  2561. X
  2562. Xwhile (TRUE)  {
  2563. X    for (pw = wtab ; TRUE ; pw++)  {
  2564. X        w = *pw;
  2565. X        if (w == NULL)  return;
  2566. X        if (wl_hascur(w))  break;
  2567. X        }
  2568. X
  2569. X    lrow = rowcursor() - w->worg_row + 1;
  2570. X    lcol = colcursor() - w->worg_col + 1;
  2571. X    (*(w->wfirst))(w, lrow, lcol);
  2572. X
  2573. X    while (wl_hascur(w))  {
  2574. X        k = u_getkey();
  2575. X        if (!ddokey(w, k, topktab)) {
  2576. X            (*(w->wkey))(w, k);
  2577. X            }
  2578. X        }
  2579. X
  2580. X    (*(w->wlast))(w);
  2581. X    }
  2582. X}
  2583. X
  2584. X
  2585. X
  2586. X/* Refresh all windows.
  2587. X * Do not move the cursor.
  2588. X */
  2589. Xwl_refresh(wtab)
  2590. Xgwindow        *wtab[];        /* Ptr to null terminated list of windows. */
  2591. X{
  2592. X    gwindow        **pw, *w;
  2593. X    int            row, col;        /* Initial global cursor location. */
  2594. X
  2595. X    row = rowcursor();
  2596. X    col = colcursor();
  2597. X
  2598. X    for (pw = wtab ; TRUE ; pw++)  {
  2599. X        w = *pw;
  2600. X        if (w == NULL)  break;
  2601. X        wl_draw(w);
  2602. X        }
  2603. X    setcursor(row, col);
  2604. X}
  2605. X
  2606. X
  2607. X
  2608. X/* Restore the cursor the the position saved in the window structure.
  2609. X * Can also be used to set the cursor by first setting the cursor coords
  2610. X * in the window data structure.
  2611. X */
  2612. Xwl_rcursor(w)
  2613. Xgwindow    *w;            /* Pointer to basic window data. */
  2614. X{
  2615. X    int    grow,gcol;    /* Global cursor locations. */
  2616. X
  2617. X    grow = w->wcur_row + w->worg_row - 1;
  2618. X    gcol = w->wcur_col + w->worg_col - 1;
  2619. X    setcursor(grow,gcol);
  2620. X    if (!wl_hascur(w))  disperr("wl_rcursor arguments out-of-bounds.");
  2621. X}
  2622. X
  2623. X
  2624. X
  2625. X/* Set the cursor to the given coordinates within a window.
  2626. X * That is, set it relative to the window's origin.
  2627. X * It displays an error if the cursor leaves the window.
  2628. X */
  2629. Xwl_setcur(w, row, col)
  2630. Xgwindow    *w;            /* Pointer to basic window data. */
  2631. Xint        row, col;    /* Local coordinates. */
  2632. X{
  2633. X    int    grow,gcol;    /* Global cursor locations. */
  2634. X
  2635. X    w->wcur_row = row;
  2636. X    w->wcur_col = col;
  2637. X    grow = w->worg_row + row - 1;
  2638. X    gcol = w->worg_col + col - 1;
  2639. X    setcursor(grow,gcol);
  2640. X    if (!wl_hascur(w))  disperr("wl_setcur arguments out-of-bounds.");
  2641. X}
  2642. X
  2643. X
  2644. X/* No-op window routine.
  2645. X */
  2646. Xwl_noop()
  2647. X{
  2648. X}
  2649. X
  2650. X
  2651. X
  2652. X/* Return TRUE if the cursor is in the given window.
  2653. X */
  2654. Xwl_hascur(w)
  2655. Xgwindow        *w;
  2656. X{
  2657. X    int        grow, gcol;        /* Global cursor location. */
  2658. X    int        lrow, lcol;        /* Cursor location relative to window. */
  2659. X
  2660. X    grow = rowcursor();
  2661. X    gcol = colcursor();
  2662. X    lrow = grow - w->worg_row + 1;
  2663. X    lcol = gcol - w->worg_col + 1;
  2664. X
  2665. X    if (lrow < 1  ||  w->wheight < lrow)  return(FALSE);
  2666. X    if (lcol < 1  ||  w->wwidth  < lcol)  return(FALSE);
  2667. X    return(TRUE);
  2668. X}
  2669. X
  2670. X
  2671. X
  2672. X/* Generic draw routine.
  2673. X */
  2674. Xwl_draw(w)
  2675. Xgwindow    *w;
  2676. X{
  2677. X    (*(w->wredraw))(w);
  2678. X}
  2679. X
  2680. X
  2681. X/* Redraw routine that can be used with any twindow.
  2682. X * Leaves cursor on the last display line.
  2683. X */
  2684. Xwl_twdraw(w)
  2685. Xtwindow    *w;
  2686. X{
  2687. X    displine    **lines, *line;
  2688. X
  2689. X    for (lines = w->dlines ; (line = *lines) != NULL ; lines++)  {
  2690. X        (*(line->wredraw))(line);
  2691. X        }
  2692. X}
  2693. X
  2694. X
  2695. X/* Erase the window by putting spaces of all of it.
  2696. X * Leave the cursor at the window's origin.
  2697. X */
  2698. Xwl_erase(w)
  2699. Xgwindow    *w;
  2700. X{
  2701. X    int    grow, gcol;        /* Global row and column locations. */
  2702. X    int i;
  2703. X
  2704. X    grow = w->worg_row;
  2705. X    gcol = w->worg_col;
  2706. X
  2707. X    for (i = 0 ; i < w->wheight ; i++)  {
  2708. X        setcursor(grow+i, gcol);
  2709. X        plnspaces(w->wwidth);
  2710. X        }
  2711. X    wl_setcur(w, 1, 1);
  2712. X}
  2713. X
  2714. X
  2715. X/* Outline a window without changing its inside.
  2716. X * Leave cursor at the origin.
  2717. X */
  2718. Xwl_outline(w)
  2719. Xgwindow    *w;
  2720. X{
  2721. X    int    grow, gcol;        /* Global row and column locations. */
  2722. X
  2723. X    grow = w->worg_row;
  2724. X    gcol = w->worg_col;
  2725. X
  2726. X    setcursor(grow, gcol);
  2727. X    plnchars(w->wwidth, '-');
  2728. X    setcursor(grow+w->wheight-1, gcol);
  2729. X    plnchars(w->wwidth, '-');
  2730. X
  2731. X    setcursor(grow, gcol);
  2732. X    vertnchars(w->wheight, '|');
  2733. X    setcursor(grow, gcol+w->wwidth-1);
  2734. X    vertnchars(w->wheight, '|');
  2735. X
  2736. X    grow = w->worg_row + w->wcur_row - 1;
  2737. X    gcol = w->worg_col + w->wcur_col - 1;
  2738. X    setcursor(grow, gcol);
  2739. X}
  2740. END_OF_windowlib.c
  2741. if test 4375 -ne `wc -c <windowlib.c`; then
  2742.     echo shar: \"windowlib.c\" unpacked with wrong size!
  2743. fi
  2744. # end of overwriting check
  2745. fi
  2746. echo shar: End of archive 2 \(of 11\).
  2747. cp /dev/null ark2isdone
  2748. MISSING=""
  2749. for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
  2750.     if test ! -f ark${I}isdone ; then
  2751.     MISSING="${MISSING} ${I}"
  2752.     fi
  2753. done
  2754. if test "${MISSING}" = "" ; then
  2755.     echo You have unpacked all 11 archives.
  2756.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2757. else
  2758.     echo You still need to unpack the following archives:
  2759.     echo "        " ${MISSING}
  2760. fi
  2761. ##  End of shell archive.
  2762. exit 0
  2763. -- 
  2764. Rich $alz            rsalz@pineapple.bbn.com
  2765. Cronus Project, BBN Labs    "Anger is an energy"
  2766.